#include<stdio.h>

int main()
{
	int a1, a2, b1, b2, c1, c2, t;
	scanf("%d:%d:%d\n%d:%d:%d",&a1, &b1, &c1, &a2, &b2, &c2);
	t = a2*3600+b2*60+c2-(a1*3600+b1*60+c1);
	printf("%d", t);
	
	return 0;
}
